package com.litxuf.logic.core.conn;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class ConnMsg {
	
	public static Connection getConnection(){
			Connection conn=null;
			try {
				Context context = new InitialContext(); 		
				DataSource ds = (DataSource)context.lookup("java:comp/env/JNDI/MusicUser");
				conn = ds.getConnection();
			} catch (NamingException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			return conn;
	}
	public static void main(String[] args) {
		System.out.print(ConnMsg.getConnection());
	}
	

}
